#include "widget.h"
#include "mythread.h"

#include <QApplication>
#include <QDebug>
#include <QObject>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();

    qDebug() << "main Thread id = "
             << QThread::currentThreadId();

    MyThread mth;//创建线程对象

    QObject::connect(&mth, &MyThread::started, []{
        qDebug() << "我started信号被触发了";
    });

    QObject::connect(&mth, &MyThread::finished, [&w]{
        //exit(0);
        w.close();
    });

    mth.start();//让线程运行起来

    return a.exec();
}
